package acwing.前缀和与差分;

import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 * @description: 差分
 * @author: qian
 * @createDate: 2021/11/12
 */
public class Difference {

    private static final int N=100010;

    public static void insert(int l, int r, int val, int []b) {
        b[l] += val;
        b[r + 1] -= val;
    }

    public static void main(String[] args) {


        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int[] a = new int[N];
        int[] b = new int[N];

        for (int i = 1; i <= n; i++) { // 给数组赋值
            a[i] = in.nextInt();
        }
        //按a数组构造b数组
        for (int i = 1; i <= n; i++) {
            insert(i,i,a[i],b);
        }

        //多次输入，给出每次修改的差分数列后的结果
        while (m-- != 0) {
            int l = in.nextInt(), r = in.nextInt(), c = in.nextInt();
            insert(l,r,c,b);
        }

        // 差分数组求和就可以得知原数组
        for (int i = 1; i <= n; i++) {
            b[i] += b[i - 1];
        }
        for (int i = 1; i <= n; i++) {
            System.out.print(b[i]+" ");
        }
    }
}
